<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>我的项目</title>
  </head>
  <style>
    *{
      margin: 0;
      padding: 0;
      text-align: center;
    }
    .header{
      background-color: #1296db;
      text-align: center;
      /*margin-top: 15px;*/
      padding-top: 25px;
      padding-bottom: 10px;
      /*height: 45px;*/

    }
    .back{
      position: absolute;
      top:30px;
    	left:15px;
    	width: 25px;
    	height: 25px;
      background: url("../../image/back.png");
      background-size: 100% 100%;
    }
    .list{
      background-color: #EAEAEA;
      padding-bottom: 10px;
      /*margin-top: 10px;*/
    }

.message{

  border: 1px solid #000;
}
.list img{
  width: 50px;
  height: 50px;
  float: left;
}
.left{

}
.company_name{
  float: left;
  margin-left: 10px;
  /*height: 40px;*/
  /*margin-top: 10px;*/
  /*background-color: red;*/
}
.hot_tags{
  float: right;
  margin-left: 10px;
  /*margin-top: 10px;*/
  /*background-color: red;*/
}
.box{
  background-color: #CDB38B;
  margin-bottom: 20px;
  height: 50px;
}
h3 {
    color: white;
    font-weight: lighter;
}
  </style>
  <body style="background:#fff">
    <div class="header">
      <a class="back" onclick="back()"></a>
      <h3>我的项目</h3>
    </div>
    <div class="message" id="mymass">

    </div>
  </body>
  <script type="text/javascript" src="../../script/jquery-3.2.1.min.js"></script>
  <script type="text/javascript" src="../../script/api.js"></script>
  <script type="text/javascript" src="../../script/main.js"></script>
  <script type="text/javascript">

    apiready=function(){
      function back(){
        api.historyBack({
            frameName: 'detail'
            }, function(ret, err) {
            if (!ret.status) {
               api.closeWin();
            }
            });
      }
      var flag=$api.getStorage('flag');
      var aid=$api.getStorage('aid');
      var url='/api/projectPosition/technicaluser/list?aid='+aid+'&page=0&size=10';
        if (flag==0) {
          var functionRet=function(ret){
              var json=ret.list;
              var url='/api/projectPosition/technicaluser/list?aid='+aid+'&page=0&size=10';
              $.each(json, function(commentIndex, comment){
                if (json[commentIndex].isSendCV==false) {
                  // console.log(199);

                    }else{
                      console.log(200);
                      var templates='<div class="list"><div class="project_company" isSendCV="'+json[commentIndex].isSendCV+'" projectId="'+json[commentIndex].projectId+'"  positionId="'+json[commentIndex].positionId+'"><div class="box"><div class="left"><img src="'+json[commentIndex].logo+'" class="company_logo"/></div><div class="left"><div class="company_name">'+json[commentIndex].businessName+'</div><div class="hot_tags"><span>'+json[commentIndex].keyWord+'</span></div></div><br><br></div></div><div class="project_name"><span>项目名称：</span><span>'+json[commentIndex].projectName+'</span><br><span>任职:</span><span>'+json[commentIndex].positionName+
                      '</span></div><div class="project_detail"><span>加入时间：</span><span>'+formatDate(json[commentIndex].createTime,'yyyy-MM-dd')+'</span><br><span>累计时间：</span><span>未知</span></div><div class="tools"><br><button class="btn btn-info evaluate">评价项目</button> <button class="btn btn-defalut apply-exit">申请退出</button></div></div><br><hr>';

                // console.log(json[commentIndex].isSendCV);
                $("#mymass").append(templates);
                // console.log(json[commentIndex].businessName);
                // console.log(32);

                }


              });
          }
          var functionErr=function(err){
              // showProgress();
          }
          //加载项目列表
          get(url,functionRet,functionErr);
        }

        $(function(){
          $(".message").on("click",".list .evaluate",function(e){
            // console.log(100);
            api.alert({
                msg: '需要跳转的页面未完成',
            });
          })
        })

        $(function(){
          $(".message").on("click",".list .apply-exit",function(e){
            var projectId=$(this).closest(".list").find(".project_company").attr("projectId");
            var url='/api/projectPosition/'+projectId+'/outApply?applyAid='+$api.getStorage('aid');
            var data={};
            var functionRet=function(ret){
              alert("退出成功！")
            }
            var functionErr=function(err){
              alert("项目申请待审核~")
            }
            //加载项目列表
            post(url,data,functionRet,functionErr)
            // console.log(100);
            // api.alert({
            //     msg: '您已投递，不可重复投递,请等待公司回复',
            // });
          })
        })



    }
  </script>
</html>
